﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DevExpress.XtraBars.Docking2010.Views;
using DevExpress.XtraBars.Docking2010.Views.Widget;
using Newtonsoft.Json;
using XCI.Helper;

namespace XCI.Windows
{
    /// <summary>
    /// 部件项
    /// </summary>
    public class WidgetItem
    {
        public WidgetItem()
        {
            Id = StringHelper.Guid();
        }

        /// <summary>
        /// 主键
        /// </summary>
        public string Id { get; set; }

        /// <summary>
        /// 显示名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 部件类型名称
        /// </summary>
        [Required(ErrorMessage = "请指定部件")]
        public string ControlType { get; set; }

        /// <summary>
        /// 是否可见
        /// </summary>
        public bool Visable { get; set; } = true;

        /// <summary>
        /// 参数字典
        /// </summary>
        public Dictionary<string, string> ParamMap { get; set; }

        /// <summary>
        /// 部件对象实例
        /// </summary>
        [JsonIgnore]
        public IWidget WidgetInstance { get; internal set; }

        /// <summary>
        /// 文档对象实例
        /// </summary>
        [JsonIgnore]
        public BaseDocument DocumentInstance { get; internal set; }
    }
}